﻿<BadHabit_Factory_Controls:GenericPanel
    
    x:Name="proposalPanel"
    
    x:Class="BadHabit.Factory.Controls.ProposalPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    xmlns:BadHabit_Factory_Controls="clr-namespace:BadHabit.Factory.Controls"        
    xmlns:BadHabit_Factory_Converters="clr-namespace:BadHabit.Factory.Converters"
    xmlns:BadHabit_Factory="clr-namespace:BadHabit.Factory"             
    xmlns:Factory_Core="clr-namespace:BadHabit.Factory;assembly=FactoryCore"
    xmlns:BadHabit_WPFTools="clr-namespace:BadHabit.WPFTools;assembly=BadHabit.WPFTools"     
    xmlns:BadHabit_WPFTools_Converters="clr-namespace:BadHabit.WPFTools.Converters;assembly=BadHabit.WPFTools"
    xmlns:Microsoft_Toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
 
    Loaded="GenericPanel_Loaded"
    DataContextChanged="GenericPanel_DataContextChanged"
    
    xmlns:props="clr-namespace:BadHabit.Factory.Properties"
    
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
    Background="Transparent">
    
    <BadHabit_Factory_Controls:GenericPanel.CommandBindings>    
        <CommandBinding Command="BadHabit_Factory:FactoryCommands.RejectProposal" CanExecute="RejectProposal_CanExecute" Executed="RejectProposal_Executed"/>
        <CommandBinding Command="BadHabit_Factory:FactoryCommands.ApproveProposal" CanExecute="ApproveProposal_CanExecute" Executed="ApproveProposal_Executed"/>
        <CommandBinding Command="BadHabit_Factory:FactoryCommands.EditProposalRoles" CanExecute="EditProposalRoles_CanExecute" Executed="EditProposalRoles_Executed"/>
        <CommandBinding Command="BadHabit_Factory:FactoryCommands.PreviewProposal" CanExecute="PreviewProposal_CanExecute" Executed="PreviewProposal_Executed"/>
        <CommandBinding Command="BadHabit_Factory:FactoryCommands.ExportProposal" CanExecute="PreviewProposal_CanExecute" Executed="ExportProposal_Executed"/>
        <CommandBinding Command="BadHabit_Factory:FactoryCommands.PrintProposal" CanExecute="PrintProposal_CanExecute" Executed="PrintProposal_Executed"/>
        <CommandBinding Command="BadHabit_Factory:FactoryCommands.AddProposal" CanExecute="AddProposal_CanExecute" Executed="AddProposal_Executed"/>
        <CommandBinding Command="ApplicationCommands.Save" CanExecute="Save_CanExecute" Executed="Save_Executed"/>
    </BadHabit_Factory_Controls:GenericPanel.CommandBindings>
    
    <BadHabit_Factory_Controls:GenericPanel.Resources>
        
        <BadHabit_Factory_Converters:XsltTemplateItemConverter x:Key="XsltTemplateConverter"/>

        <DataTemplate x:Key="RejectReasonTemplate">            
            <TextBlock Text="{Binding ., Converter={StaticResource LocalizeConverter}}"/>            
        </DataTemplate>

        <DataTemplate x:Key="ProposalTemplateItemTemplate">
            <TextBlock Text="{Binding Converter={StaticResource XsltTemplateConverter}}"/>
        </DataTemplate>
        
        <DataTemplate x:Key="ProposalTemplate">
            <StackPanel HorizontalAlignment="Center">
                <Image
                    DataContext="{Binding Status}"
                    Style="{StaticResource ProposalStatusImage}" Width="32" Height="32" HorizontalAlignment="Center" Margin="0,3,0,0"/>
                <TextBlock Text="{Binding ProposalName}" HorizontalAlignment="Center" TextAlignment="Center" Margin="0,3,0,0" TextWrapping="Wrap"/>
            </StackPanel>
        </DataTemplate>
        
        <DataTemplate x:Key="ProposalObservationItemTemplate">
            <Expander>
                <Expander.Header>
                    <TextBox Text="{Binding ObservationName}"    
                             HorizontalAlignment="Left"
                             MaxLength="150"
                             BorderThickness="0" Background="Transparent" Foreground="{StaticResource DarkTextBrush}"/>
                </Expander.Header>
                <Expander.Content>
                    <StackPanel Margin="30,0,0,0">
                        <StackPanel Orientation="Horizontal">
                            <TextBox
                                 Text="{Binding ObservationText}"                                 
                                 Style="{StaticResource FormTextBox}"
                                 MaxHeight="100"
                                 Width="400"          
                                    MaxLength="500"
                                 TextWrapping="Wrap"
                                 AcceptsReturn="True"/>
                            <Image
                                MouseLeftButtonDown="remove_MouseLeftButtonDown"
                                ToolTip="{x:Static props:Resources.Click_here_to_remove_clause}"
                                Cursor="Hand"
                                Source="/Images/ToolBar/remove.png" Width="16" Height="16" Stretch="Uniform"/>
                        </StackPanel>                        
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Style="{StaticResource Label}" Text="{x:Static props:Resources.Number}"/>
                            <TextBox Text="{Binding Order}"
                                 Style="{StaticResource FormTextBox}"                                 
                                 TextAlignment="Right"
                                 Width="30"/>
                        </StackPanel>                        
                    </StackPanel>                    
                </Expander.Content>
            </Expander>
        </DataTemplate>
        
    </BadHabit_Factory_Controls:GenericPanel.Resources>
    
    <Grid x:Name="ContentPanel" VerticalAlignment="Stretch">

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <DockPanel Grid.Row="0">
            <ToolBar DockPanel.Dock="Left" x:Name="ToolBar" ToolBarTray.IsLocked="True" Height="60"  >



                <Menu>

                    <MenuItem
                    x:Name="addProposalButton" 
                    Style="{StaticResource ToolBarMenuItem}"
                    BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="COMMERCIAL_GUY"
                    CommandTarget="{Binding ElementName=proposalGrid}"
                    Command="BadHabit_Factory:FactoryCommands.AddProposal"                    
                    Header="{x:Static props:Resources.New_Proposal}">
                        <MenuItem.Icon>
                            <Image Source="/Images/ToolBar/add.png" Stretch="Uniform" Width="32" Height="32"/>
                        </MenuItem.Icon>
                    </MenuItem>
                </Menu>
                
                <Separator/>
                
                <Menu>

                <MenuItem
                    x:Name="editRoleButton"                 
                    Style="{StaticResource ToolBarMenuItem}"
                    BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="COMMERCIAL_GUY" 
                    Header="{x:Static props:Resources.Role_Costs}"
                    CommandTarget="{Binding ElementName=proposalGrid}"
                    Command="BadHabit_Factory:FactoryCommands.EditProposalRoles">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/EditRoles.png" Stretch="Uniform" Width="32" Height="32"/>
                    </MenuItem.Icon>
                </MenuItem>

                <MenuItem
                    x:Name="previewButton"                  
                    Style="{StaticResource ToolBarMenuItem}"
                    BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="COMMERCIAL_GUY"
                    CommandTarget="{Binding ElementName=proposalGrid}"
                    Command="BadHabit_Factory:FactoryCommands.PreviewProposal"
                    Header="{x:Static props:Resources.Preview}">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/Preview.png" Stretch="Uniform" Width="32" Height="32"/>
                    </MenuItem.Icon>
                </MenuItem>

                <MenuItem
                    x:Name="exportButton"                   
                    Style="{StaticResource ToolBarMenuItem}"
                    BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="COMMERCIAL_GUY"
                    CommandTarget="{Binding ElementName=proposalGrid}"
                    Command="BadHabit_Factory:FactoryCommands.ExportProposal"
                    Header="{x:Static props:Resources.Export}">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/Export.png" Stretch="Uniform" Width="32" Height="32"/>
                    </MenuItem.Icon>
                </MenuItem>

                <MenuItem
                    
                x:Name="printButton"                        
                    Style="{StaticResource ToolBarMenuItem}"
                    CommandTarget="{Binding ElementName=proposalGrid}"
                Command="BadHabit_Factory:FactoryCommands.PrintProposal"
                Header="{x:Static props:Resources.Print}">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/Printer.png" Stretch="Uniform" Width="32" Height="32"/>
                    </MenuItem.Icon>
                </MenuItem>

            </Menu>
            
            <Separator/>
            
            <Menu>

            <MenuItem
                    x:Name="approveButton"        
                    Style="{StaticResource ToolBarMenuItem}"
                    BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="COMMERCIAL_GUY"                    
                CommandTarget="{Binding ElementName=proposalGrid}"
                    Command="BadHabit_Factory:FactoryCommands.ApproveProposal"
                    Header="{x:Static props:Resources.Approve}">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/Approve.png" Stretch="Uniform" Width="32" Height="32"/>
                    </MenuItem.Icon>
                </MenuItem>

                <!--<MenuItem
                    x:Name="rejectButton"                   
                    Style="{StaticResource ToolBarMenuItem}"
                    BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="COMMERCIAL_GUY"                                                            
                    Command="BadHabit_Factory:FactoryCommands.RejectProposal"
                    Header="{x:Static props:Resources.Reject}">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/Reject.png" Stretch="Uniform" Width="32" Height="32"/>
                    </MenuItem.Icon>
                </MenuItem>-->
                
                <MenuItem
                    x:Name="rejectButton"                   
                    Style="{StaticResource ToolBarMenuItem}"
                    BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="COMMERCIAL_GUY"                                                                                
                    Command="BadHabit_Factory:FactoryCommands.RejectProposal"
                    CommandTarget="{Binding ElementName=proposalGrid}"
                    MenuItem.SubmenuClosed="rejectButton_SubmenuClosed"
                    Header="{x:Static props:Resources.Reject}">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/Reject.png" Stretch="Uniform" Width="32" Height="32"/>
                    </MenuItem.Icon>
                    <MenuItem.Items>
                        
                            <StackPanel Orientation="Horizontal" DataContext="{Binding Proposal}">
                                <TextBlock Text="{x:Static props:Resources.Reject_reason}" Style="{StaticResource Label}"/>
                                <BadHabit_WPFTools:ComboBox                  
                                        MinWidth="180"
                                        
                                        SelectedValue="{Binding RejectReason, Converter={StaticResource EnumConverter}, ConverterParameter={x:Type Factory_Core:ProposalRejectReasons} }"   
                                        ItemsSource="{Binding Source={StaticResource ProposalRejectReasonList}}"
                                        ItemTemplate="{StaticResource RejectReasonTemplate}"
                                        SelectedItemTemplate="{StaticResource RejectReasonTemplate}"
                                    />
                            <Button Content="{x:Static props:Resources.Reject}" Command="BadHabit_Factory:FactoryCommands.RejectProposal" />
                        </StackPanel>
                        
                    </MenuItem.Items>
                </MenuItem>
                
            </Menu>




            </ToolBar>

                <Button
                        x:Name="commitButton"
                        DockPanel.Dock="Right"
                        Style="{StaticResource CommitButton}"
                        Command="ApplicationCommands.Save"
                        HorizontalAlignment="Right" 
                        Margin="5" />
        </DockPanel>




        <Grid Grid.Row="1" x:Name="proposalGrid" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Border x:Name="proposalListBoxBorder" Style="{StaticResource RoundBorder}">
                    <ListBox
                    x:Name="proposalListBox"
                    
                    SelectionChanged="proposalListBox_SelectionChanged"
                    
                    BorderThickness="0"
                    IsSynchronizedWithCurrentItem="True"
                    ItemsSource="{Binding Proposal}"
                    ItemTemplate="{StaticResource ProposalTemplate}"
                    HorizontalAlignment="Stretch"
                    HorizontalContentAlignment="Center"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                    ScrollViewer.VerticalScrollBarVisibility="Auto"
                    Width="80"/>
                </Border>

                <ScrollViewer
                Grid.Column="1"
                ScrollViewer.VerticalScrollBarVisibility="Auto">
                    <StackPanel  
                        Margin="4,4,4,4"
                        DataContext="{Binding Proposal}"
                        x:Name="proposalDetailPanel">

                        <GroupBox Header="{x:Static props:Resources.Proposal_Price}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="20"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition Height="60"/>
                                </Grid.RowDefinitions>

                                <TextBlock
                        Grid.Column="0" Grid.Row="0"
                        Text="{x:Static props:Resources.Backlog_Price}" Style="{StaticResource ToolBarBigTextBlock}"
                        Foreground="{StaticResource DarkTextBrush}"
                        HorizontalAlignment="Right" VerticalAlignment="Center"/>

                                <TextBlock
                        Grid.Column="0" Grid.Row="1"
                        Text="{x:Static props:Resources._Fixed_Costs}" Style="{StaticResource ToolBarBigTextBlock}"
                        Foreground="{StaticResource DarkTextBrush}"
                        HorizontalAlignment="Right" VerticalAlignment="Center"/>

                                <TextBlock
                        Grid.Column="0" Grid.Row="2"
                        Text="{x:Static props:Resources._Discounts}" Style="{StaticResource ToolBarBigTextBlock}"
                        Foreground="{StaticResource DarkTextBrush}"
                        HorizontalAlignment="Right" VerticalAlignment="Center"/>

                                <TextBlock
                        Grid.Column="0" Grid.Row="3"
                        Text="{x:Static props:Resources.Suggested_Price}" Style="{StaticResource ToolBarBigTextBlock}"
                        Foreground="{StaticResource DarkTextBrush}"
                        HorizontalAlignment="Right" VerticalAlignment="Center"/>

                                <TextBlock
                        Grid.Column="0" Grid.Row="4"
                        Text="{x:Static props:Resources.Proposal_Price}" Style="{StaticResource ToolBarBigTextBlock}"
                        Foreground="{StaticResource DarkTextBrush}"
                        HorizontalAlignment="Right" VerticalAlignment="Center"/>

                                <StackPanel Grid.Column="2" Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                                    <TextBlock                                
                                HorizontalAlignment="Left" VerticalAlignment="Center"
                                Width="150"
                                TextAlignment="Right"
                                Text="{Binding CalculatedBacklogPrice, StringFormat='{}{0:C}'}" Style="{StaticResource ToolBarBigTextBlock}"
                                Foreground="{StaticResource DarkTextBrush}"/>
                                    <TextBlock Margin="5,0,0,0" >
                                        <Hyperlink Click="changeSelectedItems_Click">
                                            <TextBlock Text="{x:Static props:Resources.Change_selected_items}"/>
                                            </Hyperlink>                                
                                    </TextBlock>
                                </StackPanel>

                                <StackPanel
                            Grid.Column="2" Grid.Row="1" 
                            Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                                    <TextBlock                        
                                HorizontalAlignment="Left" VerticalAlignment="Center"                            
                                Width="150"
                                TextAlignment="Right"
                                Text="{Binding CalculatedFixedCost, StringFormat='{}{0:C}'}" Style="{StaticResource ToolBarBigTextBlock}"
                                Foreground="{StaticResource DarkTextBrush}"/>
                                    <TextBlock Margin="5,0,0,0">
                                        <Hyperlink Click="changeFixedCosts_Click">
                                            <TextBlock Text="{x:Static props:Resources.Change_fixed_costs}"/>                                            
                                        </Hyperlink>
                                
                                    </TextBlock>
                                </StackPanel>

                                <StackPanel Grid.Column="2" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                                    <TextBox                
                                x:Name="discountTextBox"
                            FontFamily="{StaticResource BigFont}" FontSize="{StaticResource BigFontSize}"
                            TextAlignment="Right"
                            Width="150"                            
                            Text="{Binding Discount, StringFormat='{}{0:F1}'}"/>
                                    <TextBlock                        
                            HorizontalAlignment="Left" VerticalAlignment="Center"
                                Margin="5,0,0,0"
                            Text="%" Style="{StaticResource ToolBarBigTextBlock}"
                            Foreground="{StaticResource DarkTextBrush}"/>
                                </StackPanel>

                                <TextBlock
                            Grid.Column="2" Grid.Row="3"
                            HorizontalAlignment="Left" VerticalAlignment="Center"
                            Width="150"
                            TextAlignment="Right"
                            Text="{Binding CalculatedTotalPrice, StringFormat='{}{0:C}'}" Style="{StaticResource ToolBarBigTextBlock}"
                            Foreground="{StaticResource DarkTextBrush}"/>

                                <StackPanel Grid.Column="2" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                                    <TextBox
                                x:Name="salePriceTextBox"
                                FontFamily="{StaticResource BigFont}" FontSize="{StaticResource BigFontSize}"
                                TextAlignment="Right"
                                Width="150"
                                Text="{Binding SalePrice, StringFormat='{}{0:C}'}"
                                IsReadOnly="{Binding UseDiscount}"/>
                                    <CheckBox
                                x:Name="useDiscountCheckBox"
                                IsChecked="{Binding UseDiscount}"                                                          
                                Margin="5,0,0,0"
                                Foreground="{StaticResource DarkTextBrush}" Content="{x:Static props:Resources.Use_suggested_price}" />
                                </StackPanel>

                            </Grid>
                        </GroupBox>

                        <GroupBox Header="{x:Static props:Resources.Proposal_Details}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Label}" Text="{x:Static props:Resources.Proposal_name}"/>
                            <TextBlock Grid.Row="1" Grid.Column="0" Style="{StaticResource Label}" Text="{x:Static props:Resources.Proposal_status}"/>
                            <TextBlock Grid.Row="2" Grid.Column="0" Text="{x:Static props:Resources.Reject_reason}">
                                <TextBlock.Style>
                                    <Style BasedOn="{StaticResource Label}" TargetType="TextBlock">
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding RejectReason}" Value="{x:Null}">
                                                <Setter Property="TextBox.Visibility" Value="Collapsed"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>
                            <TextBlock Grid.Row="3" Grid.Column="0" Style="{StaticResource Label}" Text="{x:Static props:Resources.Proposal_model}"/>
                            <TextBlock Grid.Row="4" Grid.Column="0" Style="{StaticResource Label}" Text="{x:Static props:Resources.Money_short_name}"/>
                            <TextBlock Grid.Row="5" Grid.Column="0" Style="{StaticResource Label}" Text="{x:Static props:Resources.Money_rate}"/>
                                
                            <TextBlock Grid.Row="6" Grid.Column="0" Style="{StaticResource Label}" VerticalAlignment="Top" Text="{x:Static props:Resources.Details}" />
                            <TextBlock Grid.Row="7" Grid.Column="0" Style="{StaticResource Label}" VerticalAlignment="Center" Text="{x:Static props:Resources.Deadline}"/>
                            <TextBlock Grid.Row="8" Grid.Column="0" Style="{StaticResource Label}" Text="{x:Static props:Resources.Approval_date}"/>

                            <TextBox Grid.Row="0" Grid.Column="1" Style="{StaticResource FormTextBox}" Width="350" Text="{Binding ProposalName}"/>

                            <TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource LabelInfo}" DataContext="{Binding Status, Converter={StaticResource EnumConverter}, ConverterParameter={x:Type Factory_Core:ProposalStatus} }" Text="{Binding ., Converter={StaticResource LocalizeConverter}}"/>

                            <TextBox Grid.Row="2" Grid.Column="1"  DataContext="{Binding RejectReason, Converter={StaticResource EnumConverter}, ConverterParameter={x:Type Factory_Core:ProposalRejectReasons} }" Text="{Binding ., Converter={StaticResource LocalizeConverter}}">                            
                                <TextBox.Style>
                                    <Style BasedOn="{StaticResource LabelInfo}" TargetType="TextBox">
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding .}" Value="{x:Null}">
                                                <Setter Property="TextBox.Visibility" Value="Collapsed"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBox.Style>
                                
                            </TextBox>

                            <BadHabit_WPFTools:ComboBox
                            x:Name="proposalTemplateComboBox"                            
                            Grid.Row="3" Grid.Column="1"
                            Width="350"
                            Style="{StaticResource FormComboBox}"
                            ItemTemplate="{StaticResource ProposalTemplateItemTemplate}"
                            SelectedItemTemplate="{StaticResource ProposalTemplateItemTemplate}"
                            SelectedValue="{Binding TemplateName}"
                            ItemsSource="{Binding Source={StaticResource ProposalTemplateList}}"/>

                                <TextBox Grid.Row="4" Grid.Column="1" MaxLength="5" Width="50" HorizontalAlignment="Left"  Text="{Binding MoneyShortName, ValidatesOnExceptions=True, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Style="{StaticResource FormTextBox}" />
                                <TextBox Grid.Row="5" Grid.Column="1" MaxLength="4" Width="50" HorizontalAlignment="Left" Text="{Binding MoneyRate, ValidatesOnExceptions=True, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Style="{StaticResource FormTextBox}" />
                                
                                <TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Details}" Style="{StaticResource FormTextBox}" Width="350" Height="40" AcceptsReturn="True" TextWrapping="Wrap"/>

                                <StackPanel Grid.Row="7" Grid.Column="2" Orientation="Horizontal">
                                    <Microsoft_Toolkit:DatePicker SelectedDate="{Binding StartDate}"/>
                                    <TextBlock Style="{StaticResource Label}" VerticalAlignment="Center" Text="{x:Static props:Resources.to}" />
                                    <Microsoft_Toolkit:DatePicker SelectedDate="{Binding EndDate}"/>
                                </StackPanel>

                                <TextBox Grid.Row="8" Grid.Column="1" Style="{StaticResource LabelInfo}" Text="{Binding ApprovalDate}"/>

                            </Grid>

                        </GroupBox>

                        <GroupBox Header="{x:Static props:Resources.Proposal_Clauses}" VerticalAlignment="Stretch">
                            <StackPanel>
                                <Button Width="120" Click="addNewClause_Click" HorizontalAlignment="Left" Content="{x:Static props:Resources.Add_New_Clause}"/>
                                <ListBox                     
                            x:Name="observationListBox"
                            BorderThickness="0"
                            ItemsSource="{Binding FK_ProposalObservation_Proposal}"
                            ItemTemplate="{StaticResource ProposalObservationItemTemplate}"
                        />
                            </StackPanel>


                        </GroupBox>


                    </StackPanel>


                </ScrollViewer>



                <Border
                Grid.Column="2"
                Visibility="Collapsed"
                x:Name="previewBorder" Style="{StaticResource RoundBorder}">
                    <FlowDocumentScrollViewer
                x:Name="flowDocumentViewer"                
                HorizontalScrollBarVisibility="Auto"
                VerticalScrollBarVisibility="Auto"
                IsToolBarVisible="True"
            
                MinWidth="500"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                Margin="5"
                MinZoom="50"                
                Zoom="80"
                MaxZoom="100"               
                />

                </Border>

                <GridSplitter Grid.Column="1" Width="2" Background="Transparent" />

            </Grid>
      
        
        
        <StackPanel x:Name="noProposalPanel" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="400" Focusable="True">
            <TextBlock                        
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center"
                       TextAlignment="Center"
                Text="{x:Static props:Resources.Project_without_proposal}"/>
                
        </StackPanel>
        
        
        
    </Grid>

</BadHabit_Factory_Controls:GenericPanel>
